package com.ly.dingtalk.service.message;


import java.util.List;

import com.aliyun.dingtalkrobot_1_0.models.BatchOTOQueryRequest;
import com.aliyun.dingtalkrobot_1_0.models.BatchOTOQueryResponse;
import com.aliyun.dingtalkrobot_1_0.models.BatchRecallOTORequest;
import com.aliyun.dingtalkrobot_1_0.models.BatchRecallOTOResponse;
import com.aliyun.dingtalkrobot_1_0.models.BatchSendOTOResponse;
import com.aliyun.dingtalkrobot_1_0.models.OrgGroupQueryRequest;
import com.aliyun.dingtalkrobot_1_0.models.OrgGroupQueryResponse;
import com.aliyun.dingtalkrobot_1_0.models.OrgGroupRecallRequest;
import com.aliyun.dingtalkrobot_1_0.models.OrgGroupRecallResponse;
import com.aliyun.dingtalkrobot_1_0.models.OrgGroupSendRequest;
import com.aliyun.dingtalkrobot_1_0.models.OrgGroupSendResponse;
import com.ly.dingtalk.pojo.message.bot.IDingBotMsg;

import lombok.NonNull;

/**
 * 钉钉机器人消息处理器
 *
 * @author wangzhen
 */
public interface IDingBotMessageHandler {

    /**
     * 通过手机号查找钉钉用户并发送消息
     * https://open.dingtalk.com/document/isvapp/the-robot-sends-queries-and-withdraws-single-chat-messages
     * @param userIds 钉钉用户id
     * @param msg     IDingBotMsg
     * @return
     */
    BatchSendOTOResponse sendToUserByUserIds(@NonNull List<String> userIds, @NonNull IDingBotMsg msg);
    
    /**
     * https://open.dingtalk.com/document/orgapp/chatbot-batch-query-the-read-status-of-messages
     * @Description: 机器人发送的单聊信息是否已读
     * @date 2023-12-25 01:55:53
     */
    BatchOTOQueryResponse isReadSendMessage(BatchOTOQueryRequest req);
    
    /**
     * https://open.dingtalk.com/document/orgapp/batch-message-recall-chat
     * @Description: 撤回机器人单聊信息
     * @date 2023-12-25 02:02:46
     */
    BatchRecallOTOResponse recallSendMessage(BatchRecallOTORequest req);

    /**
     * 通过手机号查找钉钉用户并发送消息
     *
     * @param mobiles 手机号 无前缀+86等
     * @param msg     IDingBotMsg
     */
    BatchSendOTOResponse sendToUserByPhones(@NonNull List<String> mobiles, @NonNull IDingBotMsg msg);
    
    /**
     * https://open.dingtalk.com/document/isvapp/bots-send-query-and-recall-group-chat-messages
     * @Description: 发送群聊没有@任何人
     * @date 2023-12-25 11:20:42
     */
    OrgGroupSendResponse sendGroupChat(OrgGroupSendRequest req);
    
    /**
     * https://open.dingtalk.com/document/orgapp/chatbot-queries-the-read-status-of-a-message
     * @Description: 查询企业机器人群聊消息用户已读状态, 查的就是 sendGroupChat 方法发送的消息哪些人读了,那些人没读
     */
    OrgGroupQueryResponse orgGroupQueryWithOptions(OrgGroupQueryRequest req);
    
    /**
     * https://open.dingtalk.com/document/orgapp/enterprise-chatbot-withdraws-internal-group-messages
     * @Description: 企业机器人撤回内部群消息, 撤回sendGroupChat 发送的消息
     */
    OrgGroupRecallResponse recallGroupChat(OrgGroupRecallRequest req);

}
